package com.lk.common.comet4j;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/comet")
public class Comet4jTestController {
	
	@Autowired
	private Comet4jPushMessage comet4jPushMessage;
	
	@RequestMapping("/test")
	@ResponseBody
	public void test(){
		while(true) {
			try {
				Thread.sleep(5000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			comet4jPushMessage.sendAll(MessageType.NOTICE,new SendData(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())));
		}
	}
	
}
